#include <stdio.h>
#include <assert.h>
#include "thread.h"

void * thfunc(void * dummy){

  printf("Je suis le thread qui s'execute \n");
  thread_yield();
  printf("je n'ai pas été annulé\n");
  return 0;
}

int main()
{
  thread_t th;
  int err;

  err = thread_create(&th, thfunc, NULL);
  assert(!err);
  thread_yield();
  thread_cancel(th);
  thread_yield();
  err = thread_join(th,NULL);
  assert(err==THREAD_CANCELED);
  return 0;

}
